<!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
	    		xmlns:ui="http://java.sun.com/jsf/facelets"
	  			xmlns:h="http://java.sun.com/jsf/html"
	  			xmlns:f="http://java.sun.com/jsf/core"
                xmlns:sf="http://www.springframework.org/tags/faces"
                xmlns:sec="http://www.springframework.org/security/facelets/tags"
                xmlns:spring="http://www.springframework.org/tags"
				template="/WEB-INF/layouts/template.xhtml">

<ui:define name="main">
<script type="text/javascript">document.getElementById('menuProjects').className="selected";</script>
<script type="text/javascript">document.getElementById('doc3').className="yui-t6";</script>
<div id="yui-main">
	<div class="yui-b">
		<div id="wrapper" class="yui-u first">
			<h3 class="title">${msg.title_category_review} ${category.name}</h3>    
			<div id="mainContent">
				<h3>${msg.title_category_subcategories}</h3>
				<h:outputText value="${msg.category_noSubcategories}" rendered="${subcategories.rowCount == 0}"/>
				<h:form id="subcategories">
				    <h:dataTable id="subcategories" styleClass="summary" value="${subcategories}" var="subcategory" rendered="${subcategories.rowCount > 0}"> 
				    	<h:column >
				    		<f:facet name="header">${msg.name}</f:facet>
				    		<sf:commandLink id="viewCategoryLink" action="select">${subcategory.name}</sf:commandLink>
				    	</h:column>
				    	<h:column >
				    		<f:facet name="header">${msg.description}</f:facet>
				    		${subcategory.description}
				    	</h:column>
				    </h:dataTable>
				    <sec:ifAnyGranted roles="ROLE_ADMIN">
					    <div>
							<sf:commandLink id="add" action="add"><div class="button">${msg.add} ${msg.category}</div></sf:commandLink>
						</div>
					</sec:ifAnyGranted>
			    </h:form>
				<br/>
				<br/>
				<h3>${msg.title_category_tasks}</h3>
				<ui:fragment id="tasksFragment">
					<h:outputText value="${msg.category_noTasks}" rendered="${tasks.rowCount == 0}"/>
					<h:form id="tasks">
					    <h:dataTable id="tasks" styleClass="summary" value="${tasks}" var="t" rendered="${tasks.rowCount > 0}">
					    	<sec:ifAnyGranted roles="ROLE_ADMIN">
					    		<h:column>
									<f:facet name="header"></f:facet>
									<sf:commandLink id="editTaskLink" action="editTask" title="${msg.edit}"><img class="icon" src="${request.contextPath}/resources/images/edit.png"/></sf:commandLink>
									<h:outputText value=" " />
									<sf:commandLink id="deleteTaskLink" action="deleteTask" title="${msg.delete}"><img class="icon" src="${request.contextPath}/resources/images/delete.png"/></sf:commandLink>
								</h:column>
						    	<h:column >
						    		<f:facet name="header">${msg.member}</f:facet>
						    		<sf:commandLink id="reviewMember" value="${t.assignedMember.contact.name}" action="reviewMember" />
						    	</h:column>
					    	</sec:ifAnyGranted>
					    	<h:column >
					    		<f:facet name="header">${msg.startdate}</f:facet>
					    		<h:outputText value="${t.startDate}">
					    			<f:convertDateTime timeZone="${timezone}" pattern="dd/MM/yy HH:mm"/>
					    		</h:outputText>
					    	</h:column>
					    	<h:column >
					    		<f:facet name="header">${msg.enddate}</f:facet>
					    		<h:outputText value="${t.endDate}">
					    			<f:convertDateTime timeZone="${timezone}" pattern="dd/MM/yy HH:mm"/>
					    		</h:outputText>
					    	</h:column>
					    	<h:column>
						    	<f:facet name="header">${msg.comment}</f:facet>
						    	${t.comment}
						    </h:column>
					    </h:dataTable>
					    <div>
							<sf:commandLink id="addTask" action="addTask"><div class="button">${msg.add} ${msg.task}</div></sf:commandLink>
						</div>
				    </h:form>
			    </ui:fragment>
			</div>
		</div>
	</div>
</div>
<div class="yui-b">
	<h3 class="title">${category.name}</h3>
	<div class="wrapper">
		<h:form>
			<h:panelGroup rendered="${!(empty category.description)}">
				<div class="field">
					<h:outputText value="${msg.description}: ${category.description}" />
				</div>
			</h:panelGroup>
			<div>
				<sec:ifAnyGranted roles="ROLE_ADMIN">
					<sf:commandLink id="edit" action="edit"><div class="button">${msg.edit}</div></sf:commandLink>
					<sf:commandLink id="delete" action="delete"><div class="button">${msg.delete}</div></sf:commandLink>
				</sec:ifAnyGranted>
			</div>
		</h:form>
	</div>
</div>
<div style="clear: both; height: 5px;" />
<h:form><sf:commandLink id="back" action="back"><div class="button">${msg.back} ${msg.parent}</div></sf:commandLink></h:form>
</ui:define>
</ui:composition>